<template>
    <div class="j-button" :class="{ clicked }" v-bind="$attrs" @click="onClick">
        <slot></slot>
        <span>{{ label }}</span>
    </div>
</template>

<script lang="ts" setup>
import { ref, watch, onMounted, computed } from "vue";

const props = defineProps({
    label: String
});

const clicked = ref(false);

const emit = defineEmits(["click"]);

const onClick = () => {
    emit("click");
    clicked.value = true;
    setTimeout(() => {
        clicked.value = false;
    }, 2000);
};
</script>

<style lang="less" scoped>
@import url("./index.less");
</style>
